package com.ror.java.se.scanner;

import java.util.Scanner;

public class Demo02NextFloat {
    public static void main(String[] args) {
        ScanNextFloat();
    }

    public static void ScanNextFloat() {
        System.out.print("输入一个小数：");
        Scanner sc = new Scanner(System.in);
        if (!sc.hasNextFloat()) {
            System.out.println("输入的不是小数！");
            sc.close();
            return;
        }
        System.out.println("你的输入：" + sc.nextFloat());
        sc.close();
    }
}
